<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/3/3
 * Time: 17:37
 */

namespace App\Http\Traits;


use Illuminate\Http\Request;

trait CommonTrait
{
    use BaseTrait;

    // COS上的bucket
    protected $bucket;

    // COS区域
    protected $region;

    // 封面地址
    protected $cover_url;
    // 视频高度
    protected $height;
    // 视频宽度
    protected $width;
    // 图片
    protected $photo;
    // 图片文件
    protected $photo_file;
    // 链接地址
    protected $url;

    public function __construct(Request $request)
    {
        $this->bucket = $request->input('bucket', '');
        $this->region = $request->input('region', '');
        $this->cover_url = $request->input('cover_url', '');
        $this->height = $request->input('height', 0);
        $this->width = $request->input('width', 0);
        $this->photo = $request->input('photo', '');
        $this->photo_file = $request->input('photo_file');
        if (!empty($request->file('file', ''))){
            $this->photo_file = $request->file('file', '')->store('temp');
        }
        $this->url = $request->input('url');
    }
}